
#ifndef TARGET_CONTAINER_H_INCLUDED_
#define TARGET_CONTAINER_H_INCLUDED_

#include "alkes.h"
#include "alkes/gfxfilter.h"
#include "alkes/alkestree.h"
#include "alkes/testdriver.h"

class TargetContainer
{
public:
    TargetContainer();
    ~TargetContainer();

    bool init(HWND hwnd);

    bool flip();
    void resize(uint16_t width, uint16_t height);

    typedef void (TargetContainer::*TestCaseFunc)(alkes::RenderTarget2DTestDriver&);
    bool render(TestCaseFunc testcase);

    // System API
    void RenderTarget2DTestDriver_Snapshot(alkes::RenderTarget2DTestDriver& driver);
    void RenderTarget2DTestDriver_Draw2D(alkes::RenderTarget2DTestDriver& driver);
    void RenderTarget2DTestDriver_Scissor(alkes::RenderTarget2DTestDriver& driver);

    // Configuration
    void RenderTarget2DTestDriver_AlphaBlend(alkes::RenderTarget2DTestDriver& driver);
    void RenderTarget2DTestDriver_Brush(alkes::RenderTarget2DTestDriver& driver);

    // Rendering
    void RenderTarget2DTestDriver_Fill(alkes::RenderTarget2DTestDriver& driver);
    void RenderTarget2DTestDriver_FillRectangle(alkes::RenderTarget2DTestDriver& driver);
    void RenderTarget2DTestDriver_DrawRectangle(alkes::RenderTarget2DTestDriver& driver);
    void RenderTarget2DTestDriver_DrawImagePng(alkes::RenderTarget2DTestDriver& driver);
    void RenderTarget2DTestDriver_DrawImageJpeg(alkes::RenderTarget2DTestDriver& driver);
    void RenderTarget2DTestDriver_DrawLine(alkes::RenderTarget2DTestDriver& driver);
    void RenderTarget2DTestDriver_DrawPolyline(alkes::RenderTarget2DTestDriver& driver);

    // Transform
    void RenderTarget2DTestDriver_Transform(alkes::RenderTarget2DTestDriver& driver);
    void RenderTarget2DTestDriver_Translate(alkes::RenderTarget2DTestDriver& driver);
    void RenderTarget2DTestDriver_Scale(alkes::RenderTarget2DTestDriver& driver);
    void RenderTarget2DTestDriver_Rotate(alkes::RenderTarget2DTestDriver& driver);
    void RenderTarget2DTestDriver_Skew(alkes::RenderTarget2DTestDriver& driver);


    // Scene graph
    bool render(const alkes::Rect* dirty_rect = 0);
    void update();
    void Screen2DTestDriver_beginTestCase1();

private:
    alkes::intrusive_ptr<alkes::GfxFilterGraphics> graphics_;
    alkes::Screen2DTestDriver* screen_test_;
};

#endif
